package osami.communication;

/**
 * BluetoothLongAddress means the whole bluetooth connection phrase, including the connection port, encryption option, slave option etc.
 * @author osami1
 *
 */
public class BluetoothLongAddress implements Address
{
	String iAddress;
	
	
	public BluetoothLongAddress( String aAddress )
	{
		iAddress = aAddress;
	}
	
	/**
	 * Compares the address given to existing connections and returns the result as boolean
	 * 
	 * @param aAddress
	 * @return Boolean
	 */
	public boolean equals( Address aAddress )
	{
		//System.out.println("Comparing: "+ aAddress + " to: " + iAddress);
		if (aAddress.getClass() == BluetoothAddress.class) {
		return iAddress.substring(8, 20).contentEquals( aAddress.toString() );
		}
		return iAddress.contentEquals( aAddress.toString());
	}
	
	/**
	 * returns the address as a string
	 * @return String
	 */
	public String toString()
	{
		return iAddress;
	}
	
	/**
	 * returns the hostname as a string
	 * @return String
	 */
	public String getHostName()
	{
		//was 8,22
		return iAddress.substring( 8, 20 );
	}
}
